import {
	mapMutations
} from 'vuex'
export default {
	...mapMutations([
		'upUserInfo'
	]),
	submitForm() {
		let that = this
		if (that.atLoading) {
		    //禁止多次点击
		    return false
		}
		that.atLoading = true
		that.$httpRequest.request({
			that: that,
			url: 'h5/editNickname',
			params: {
				nickname: that.userInfo.nickname
			},
			success: res => {
				that.$toast.alert({
					content: res.message,
					callback: result => {
						if (result.confirm) {
							if (res.code === that.$httpConfig.SUCCESS_CODE) {
								that.upUserInfo(that.userInfo)
								uni.navigateBack({
									delta: 1
								})
							}
						}
					}
				})
			}
		})
		setTimeout(()=>{ //延时指定时间后，再解冻
		    that.atLoading = false;
		}, 1000);
	}
}
